package co.yixiang.yshop.module.crm.controller.admin.crmanalysis;

import co.yixiang.yshop.framework.common.pojo.CommonResult;
import co.yixiang.yshop.framework.common.pojo.PageResult;
import co.yixiang.yshop.module.crm.controller.admin.crmanalysis.vo.*;
import co.yixiang.yshop.module.crm.service.crmanalysis.CustomerService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import static co.yixiang.yshop.framework.common.pojo.CommonResult.success;

@Tag(name = "管理后台 - 客户分析")
@RestController
@RequestMapping("/crm/analysis-customer")
@Validated
public class CustomerController {

    @Resource
    private CustomerService customerService;



    @GetMapping("/level")
    @Operation(summary = "获得客户等级分析")
    public CommonResult<CustomerLevelVO> getCustomerLevel() {
        return success(customerService.getCustomerLevel());
    }

    @GetMapping("/source")
    @Operation(summary = "获得客户来源分析")
    public CommonResult<CustomerLevelVO> getCustomerSource() {
        return success(customerService.getCustomerSource());
    }

    @GetMapping("/industry")
    @Operation(summary = "获得客户行业分析")
    public CommonResult<CustomerLevelVO> getCustomerIndustry() {
        return success(customerService.getCustomerIndustry());
    }

    @GetMapping("/volume")
    @Operation(summary = "获得客户量分析")
    public CommonResult<PageResult<UserVolumeVO>> getAchievementPage(@Valid AchievementPageReqVO pageReqVO) {
        return success(customerService.getCustomerVolume(pageReqVO));
    }

    @GetMapping("/record")
    @Operation(summary = "获得跟进分析")
    public CommonResult<PageResult<UserRecordVO>> getRecord(@Valid AchievementPageReqVO pageReqVO) {
        return success(customerService.getRecord(pageReqVO));
    }




}